1 Einleitung

In diesem Notebook werden die Daten, welche in dem Notebook Datenintegration vorbereitet wurden, mit Hilfe von Visualisierungen analysiert. Dies ist der erste Teil des gewünschten Outputs des Projekts (siehe Abbildung 1).

Abbildung 1: Konzeptionelles Vorgehen, Eigene Darstellung 2021

2 Vorbereitung

2.1 Notwendige Pakete laden

In diesem Notebook werden die folgenden Pakete verwendet:

library(tidyverse)
library(ggplot2) #Visualisierung
library(plotly)
library(scales)
library(lubridate)
library(DT)

2.2 Daten importieren

Der im Abschnitt Datenintegration erstellte Datensatz mobility_vaccine wird für dieses Notebook Datenanalyse herangezogen.

mobility_vaccine <- read.csv("../Website/Daten_Output/Mobility_vaccine.csv")

2.3 Beschreibung des finalen Datensatzes

glimpse(mobility_vaccine)
## Rows: 27,888
## Columns: 17
## $ X                     <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1~
## $ date                  <chr> "2020-12-27", "2020-12-27", "2020-12-27", "2020-~
## $ Bundesland            <chr> "Baden-Württemberg", "Baden-Württemberg", "Bayer~
## $ ID                    <int> 8, 8, 9, 11, 12, 4, 4, 2, 6, 6, 13, 3, 5, 5, 7, ~
## $ Impfstoff             <chr> "Comirnaty", "Moderna", "Comirnaty", "Comirnaty"~
## $ Impfserie             <int> 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, ~
## $ Anzahl                <int> 2610, 3, 3606, 1770, 28, 3, 511, 443, 2, 2712, 3~
## $ Einwohner_2020        <int> 11103043, 11103043, 13140183, 3664088, 2531071, ~
## $ country_region_code   <chr> "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", ~
## $ country_region        <chr> "Germany", "Germany", "Germany", "Germany", "Ger~
## $ iso_code              <chr> "DE-BW", "DE-BW", "DE-BY", "DE-BE", "DE-BB", "DE~
## $ retail_and_recreation <int> -68, -68, -68, -74, -61, -77, -77, -75, -68, -68~
## $ grocery_and_pharmacy  <int> -39, -39, -41, -39, -37, -39, -39, -32, -40, -40~
## $ parks                 <int> -5, -5, -5, -38, -12, -45, -45, -50, -12, -12, -~
## $ transit_stations      <int> -53, -53, -55, -56, -41, -61, -61, -61, -56, -56~
## $ workplaces            <int> -30, -30, -27, -29, -20, -30, -30, -31, -27, -27~
## $ residential           <int> 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, ~

Der ursprüngliche Datensatz besteht aus 17 Variablen. Einige der Variablen werden für das Dashboard (Output Teil 2) verwendet, sind aber für die folgende Analyse nicht relevant. Deshalb werden diese Variablen entfernt.

excluded_vars <- c("X", "country_region_code", "country_region", "iso_code", "ID", "Impfserie")

mobility_vaccine <- select(mobility_vaccine, -excluded_vars)
## Note: Using an external vector in selections is ambiguous.
## i Use `all_of(excluded_vars)` instead of `excluded_vars` to silence this message.
## i See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This message is displayed once per session.
no_cols<- ncol(mobility_vaccine)
no_rows<- nrow(mobility_vaccine)

Der finale Datensatz mobility_vaccine besteht aus 11 Spalten und 27888 Zeilen. In der folgenden Tabelle werden die Variablen und ihre Merkmale beschrieben.

Variable Beschreibung Datentyp
date Datum Character
bundesland Bundesland Character
ID Bundesland_ID Integer
Impfstoff Impfstoff verwendet Character
Impfserie Serie Impfstoff verwendet Integer
Anzahl Anzahl Impfungen pro Tag Integer
Einwohner_2020 Einwohnerzahl pro Bundesland Integer
retail_and_recreation Einzelhandel und Erholung Integer
grocery_and_pharmacy Lebensmittel und Apotheken Integer
parks Park (z.B.: Öffentlicher Park, Schloss, Waldgebiete Integer
transit_stations Transitstationen Integer
workplaces Arbeitsstätten Integer
residential Haus und Wohnungen Integer

Die Funktion ymd wandelt in Zeichen- und numerischen Vektoren gespeicherte Daten in Date- oder POSIXct-Objekte um. Aus dem Character date wird ein Dateobjekt gemacht.

mobility_vaccine$date <- ymd(mobility_vaccine$date)

Des weiteren wird die Spalte date dupliziert, damit drei neue Spalten Year, Month und Date erstellt werden können. Diese Anpassung erfolgt zur Vereinfachung der Aggregierung der Daten. Im nächsten Schritt eine zusätzliche Spalte mit der Bezeichnung year_month erstellt. Somit können Visualisierungen für den gesamten Zeitraum auf monatsebene erstellt werden.

mobility_vaccine <- mobility_vaccine %>% 
                mutate(date_2 = date)%>% 
   separate(date_2, c("Year", "Month", "Day"), sep="-")%>% 
            unite(year_month, c(Year, Month), sep = "/", remove = FALSE)

Da der Impfstoff Janssen nach einer einmaligen Impfung den vollen Impfstoff bietet, werden die weiteren Impfstoffe (mind. 2 Impfungen Stand heute) durch 2 geteilt. Somit kann der Impffortschritt besser verglichen werden.

mobility_vaccine <-mobility_vaccine  %>%
  mutate(impf_fortschritt = case_when(Impfstoff == "Comirnaty" ~ Anzahl/2,
                                      Impfstoff == "AstraZeneca" ~ Anzahl/2,
                                      Impfstoff == "Moderna" ~ Anzahl/2,
                                      Impfstoff == "Janssen" ~ Anzahl*1))

Um das Verhältnis der Impfungen in Relation zu den Einwohnerzahlen zur bringen wird als nächstes die Impfquote berechnet. Hierzu wird der Impffortschritt also die Anzahl der Impfungen in das Verhältnis zu der Einwohnerzahl gesetzt und _*100_ multipliziert.

mobility_vaccine <-mobility_vaccine  %>%
  mutate(impf_quote = (impf_fortschritt/Einwohner_2020)*100)

Das R-Paket DT bietet eine R-Schnittstelle zur JavaScript-Bibliothek DataTables. R-Datenobjekte (Matrizen oder Datenrahmen) können als Tabellen auf HTML-Seiten angezeigt werden, und DataTables bietet Filterung, Paginierung, Sortierung und viele andere Funktionen in den Tabellen.

Der für die Analyse herangezogene Datensatz sieht nun wie folgt aus:

mobility_vaccine_head <- mobility_vaccine%>% slice(1:50)

datatable(mobility_vaccine_head, filter = 'top', options = list(
  pageLength = 5, autoWidth = TRUE
)) %>% 
  formatDate('date', 'toDateString') %>% 
  formatCurrency(c('retail_and_recreation','grocery_and_pharmacy', 'parks', 'transit_stations', 'workplaces','residential'), '%') %>% 
  formatPercentage('impf_quote',2)

3 Analyse des finalen Datensatzes

3.1 Betrachtungszeitraum

Der Betrachtungszeitraum liegt zwischen dem 27.12.2020 bis zum 15.10.2021.

mobility_vaccine %>% 
    select(date) %>% 
    summarise(max = max(date, na.rm = TRUE), min = min(date, na.rm = TRUE))
##          max        min
## 1 2021-10-15 2020-12-27

3.2 Deutschland Impfung gesamt

summe_impfungen_gesamt <-mobility_vaccine %>%
              summarise(
              sum_impfungen = sum(Anzahl))

In dem Zeitraum vom 27.12.2020 bis 15.10.2021 wurden in Deutschland 109521652 Impfungen verabreicht.

3.3 Deutschland Impfung pro Jahr

In 2020 wurden in Summe 207.060 Impfungen verabreicht, während in 2021 bis zum 15.10.2021 in Summe 109.314.592 Impfungen verabreicht wurden (inkl. Zweitimpfung).

graph_0 <- mobility_vaccine %>%
  group_by(Year) %>% 
  summarise(summe_pro_jahr = sum(Anzahl)) %>% 
  ggplot(aes(x = Year, y = summe_pro_jahr))+
  geom_col(colour="darkslategray", fill = "darkslategray4")+
  theme_classic()+
  scale_y_continuous(labels = function(x) format(x, big.mark = ".",
                                                scientific = FALSE)) +
  labs(
    y = element_blank(),
    x = element_blank()
  )

ggplotly(graph_0) %>%
  layout(title = list(text = paste0("Covid Impfungen",
                                    '<br>',
                                    '<sup>',
                                     "Impfungen gesamt nach Jahr",'</sup>')))

3.4 Welcher Impfstoff wurde am häufigsten verabreicht?

Der Impfstoff Biontech/Comirnaty wurde in Summe am häufigsten verabreicht (84.047.591). Von dem Impfstoff AstraZeneca wurden 12.670.077 Dosen geimpft, Moderna folgt mit 9.553.672 Impfungen und Janssen mit 3.250.312 Dosen.

graph_1 <- mobility_vaccine %>%
  group_by(Impfstoff) %>% 
  summarise(summe_impfungen = sum(Anzahl)) %>% 
  ggplot(aes(x = Impfstoff, y=summe_impfungen))+
  geom_col(colour="darkslategray", fill = "darkslategray4")+
  theme_classic()+
  scale_y_continuous(labels = function(x) format(x, big.mark = ".",
                                                scientific = FALSE)) +
  labs(
    y = element_blank(),
    x = element_blank()
  )

ggplotly(graph_1) %>%
  layout(title = list(text = paste0("Covid Impfungen",
                                    '<br>',
                                    '<sup>',
                                     "Anzahl Impfungen nach Impfstoff",'</sup>')))
graph_2 <-mobility_vaccine %>%
  group_by(Year, Impfstoff) %>%
  summarise(Impfungen = sum(Anzahl)) %>% 
  ggplot(aes(x = Year, y = Impfungen, group = Impfstoff, colour = Impfstoff, fill = Impfstoff))+
  geom_col(size=1.2)+ 
  scale_y_continuous(labels = function(x) format(x, big.mark = ".",
                                                scientific = FALSE))+
  theme_minimal()+
  labs(
    y = element_blank(),
    x = element_blank()
  )
## `summarise()` has grouped output by 'Year'. You can override using the `.groups` argument.
ggplotly(graph_2) %>%
  layout(title = list(text = paste0("Covid Impfungen",
                                    '<br>',
                                    '<sup>',
                                     "Anzahl Impfungen nach Impfstoff pro Jahr",'</sup>')))

3.5 Impfungen zeitlicher Verlauf (pro Monat & Jahr)

Mit Hilfe der folgenden Funktion wird die Anzahl der Impfungen pro Monat aufgezeigt.

graph_3 <-mobility_vaccine %>%
  group_by(year_month) %>%
  summarise(Impfungen = sum(Anzahl)) %>% 
  ggplot(aes(x = year_month, y = Impfungen))+
  geom_col(size=1.2, colour="darkslategray", fill = "darkslategray4")+ 
  scale_y_continuous(labels = function(x) format(x, big.mark = ".",
                                                scientific = FALSE))+
  theme_minimal()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = element_blank(),
    x = element_blank()
  )


ggplotly(graph_3) %>%
  layout(title = list(text = paste0("Covid Impfungen",
                                    '<br>',
                                    '<sup>',
                                     "Anzahl Impfungen pro Monat",'</sup>')))

3.6 Deutschland Impfung pro Bundesland

graph_4 <-mobility_vaccine %>%
  group_by(Bundesland) %>%
  summarise(sum_impfungen = sum(Anzahl), 
    min_anzahl = min(Anzahl),
    mean_anzahl = mean(Anzahl)) %>% 
  ggplot(aes(x = reorder(Bundesland, -sum_impfungen), y = sum_impfungen))+
  geom_col(size=1.2, colour="darkslategray", fill = "darkslategray4")+ 
  scale_y_continuous(labels = function(x) format(x, big.mark = ".",
                                                scientific = FALSE))+
  theme_minimal()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = element_blank(),
    x = element_blank()
  )

ggplotly(graph_4) %>%
  layout(title = list(text = paste0("Covid Impfungen",
                                    '<br>',
                                    '<sup>',
                                     "Anzahl Impfungen pro Bundesland",'</sup>')))

3.7 Einwohner pro Bundesland

einwohner <- mobility_vaccine %>%
  distinct(Bundesland, Einwohner_2020) 

datatable(einwohner, filter = 'top')
 graph_5<-mobility_vaccine %>%
  group_by(Bundesland) %>%
  summarise(Einwohner = min(Einwohner_2020)) %>% 
  ggplot(aes(x = reorder(Bundesland, -Einwohner), y = Einwohner))+
  geom_col(size=1.2, colour="darkslategray", fill = "darkslategray4")+ 
  scale_y_continuous(labels = function(x) format(x, big.mark = ".",
                                                scientific = FALSE))+
  theme_minimal()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = element_blank(),
    x = element_blank()
  )

ggplotly(graph_5) %>%
  layout(title = list(text = paste0("Einwohner pro Bundesland",
                                    '<br>',
                                    '<sup>',
                                     "absteigend sortiert",'</sup>')))

3.8 Impfquote

graph_6 <- mobility_vaccine %>%
  group_by(Bundesland) %>% 
  summarise(quote = sum(impf_quote)) %>%  
  ggplot()+
  geom_point(aes(x = reorder(Bundesland, -quote), y = quote), size=2, colour="darkslategray")+
  geom_col(aes(x = reorder(Bundesland, -quote), y = quote), colour="darkslategray4", fill="darkslategray4")+
  scale_y_continuous(labels = comma_format(big.mark = ".",
                                          decimal.mark = ","))+
  theme_minimal()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Impfquote [%]",
    x = element_blank()
  )+ylim(0,100)
## Scale for 'y' is already present. Adding another scale for 'y', which will
## replace the existing scale.
ggplotly(graph_6) %>%
  layout(title = list(text = paste0("Impfquote pro Bundesland",
                                    '<br>',
                                    '<sup>',
                                     "absteigend sortiert",'</sup>')))

3.9 Impfverlauf

graph_7 <-mobility_vaccine %>%
  group_by(year_month, Impfstoff) %>%
  summarise(Impfungen = sum(Anzahl)) %>% 
  ggplot(aes(x = year_month, y = Impfungen, group = Impfstoff, colour = Impfstoff, fill = Impfstoff))+
  geom_col()+ 
  scale_y_continuous(labels = comma_format(big.mark = ".",
                                          decimal.mark = ","))+
  theme_minimal()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Anzahl",
    x = element_blank()
  )
## `summarise()` has grouped output by 'year_month'. You can override using the `.groups` argument.
ggplotly(graph_7) %>%
  layout(title = list(text = paste0("Anzahl Covid Impfungen",
                                    '<br>',
                                    '<sup>',
                                     "Pro Monat & Bundesland",'</sup>')))

3.10 Retail and recreation gesamt

graph_8 <- ggplot(mobility_vaccine, aes(x = date, y = retail_and_recreation)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_8) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Einzelhandel und Erholung",'</sup>')))
graph_9 <- ggplot(mobility_vaccine, aes(x = date, y = retail_and_recreation, fill = Bundesland, color = Bundesland)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_9) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Einzelhandel und Erholung",'</sup>')))

3.11 grocery and pharmacy

graph_10 <- ggplot(mobility_vaccine, aes(x = date, y = grocery_and_pharmacy)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_10) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Apotheken und Läden des täglichen Bedarfs",'</sup>')))
graph_11 <- ggplot(mobility_vaccine, aes(x = date, y = grocery_and_pharmacy, fill = Bundesland, color = Bundesland)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_11) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Apotheken und Läden des täglichen Bedarfs",'</sup>')))

3.12 parks

graph_12 <- ggplot(mobility_vaccine, aes(x = date, y = parks)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_12) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie öffentlichen Parks, Schlössern, Waldgebieten etc.",'</sup>')))
graph_13 <- ggplot(mobility_vaccine, aes(x = date, y = parks, fill = Bundesland, color = Bundesland)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_13) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Apotheken und Läden des täglichen Bedarfs",'</sup>')))

3.13 transit_stations

graph_14 <- ggplot(mobility_vaccine, aes(x = date, y = transit_stations)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_14) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Transitstationen",'</sup>')))
graph_15 <- ggplot(mobility_vaccine, aes(x = date, y = transit_stations, fill = Bundesland, color = Bundesland)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_15) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Transitstationen",'</sup>')))

3.14 workplaces

graph_16 <- ggplot(mobility_vaccine, aes(x = date, y = workplaces)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_16) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "Am Arbeitsplatz",'</sup>')))
graph_17 <- ggplot(mobility_vaccine, aes(x = date, y = workplaces, fill = Bundesland, color = Bundesland)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_17) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "Am Arbeitsplatz",'</sup>')))

3.15 residential

graph_18 <- ggplot(mobility_vaccine, aes(x = date, y = residential)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_18) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "An Orten wie Wohngebieten",'</sup>')))
graph_19 <- ggplot(mobility_vaccine, aes(x = date, y = residential, fill = Bundesland, color = Bundesland)) +
  geom_point()+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("1 month"))+
  theme_classic()+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    y = "Abweichung zum Referenzwert [%]",
    x = element_blank()
  )

ggplotly(graph_19) %>%
  layout(title = list(text = paste0("Mobilitätsaufkommen",
                                    '<br>',
                                    '<sup>',
                                     "In Wohngebieten",'</sup>')))

3.16 Mobilitätsaufkommen vs. Impfungen

mobility_vaccine %>%
  group_by(date) %>% 
  summarise(max = mean(retail_and_recreation),
            sum = sum(Anzahl)) %>% 
  summarise(max = max,
            sum = cumsum(sum),
            date = date) %>% 
  ggplot()+
  geom_line(aes(x = date, y = max), size = 0.8, color = "darkslategray")+
  geom_line(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_point(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  scale_y_continuous(sec.axis = sec_axis(~.*1,name = "Anzahl Impfungen kumuliert [Mio]"))+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("2 weeks"))+
  theme_classic()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    title = "Mobilitätsaufkommen vs Impfverlauf",
    subtitle = "An Orten wie Einzelhandel und Erholung",
    y = "Abweichung zum Rezerenzwert [%]"
  )

mobility_vaccine %>%
  group_by(date) %>% 
  summarise(max = mean(grocery_and_pharmacy),
            sum = sum(Anzahl)) %>% 
  summarise(max = max,
            sum = cumsum(sum),
            date = date) %>% 
  ggplot()+
  geom_line(aes(x = date, y = max), size = 0.8, color = "darkslategray")+
  geom_line(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_point(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  scale_y_continuous(sec.axis = sec_axis(~.*1,name = "Anzahl Impfungen kumuliert [Mio]"))+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("2 weeks"))+
  theme_classic()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    title = "Mobilitätsaufkommen vs Impfverlauf",
    subtitle = "An Orten wie Einzelhandel und Erholung",
    y = "Abweichung zum Rezerenzwert [%]"
  )

mobility_vaccine %>%
  group_by(date) %>% 
  summarise(max = mean(parks),
            sum = sum(Anzahl)) %>% 
  summarise(max = max,
            sum = cumsum(sum),
            date = date) %>% 
  ggplot()+
  geom_line(aes(x = date, y = max), size = 0.8, color = "darkslategray")+
  geom_line(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_point(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  scale_y_continuous(sec.axis = sec_axis(~.*1,name = "Anzahl Impfungen kumuliert [Mio]"))+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("2 weeks"))+
  theme_classic()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    title = "Mobilitätsaufkommen vs Impfverlauf",
    subtitle = "An Orten wie Einzelhandel und Erholung",
    y = "Abweichung zum Rezerenzwert [%]"
  )

mobility_vaccine %>%
  group_by(date) %>% 
  summarise(max = mean(transit_stations),
            sum = sum(Anzahl)) %>% 
  summarise(max = max,
            sum = cumsum(sum),
            date = date) %>% 
  ggplot()+
  geom_line(aes(x = date, y = max), size = 0.8, color = "darkslategray")+
  geom_line(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_point(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  scale_y_continuous(sec.axis = sec_axis(~.*1,name = "Anzahl Impfungen kumuliert [Mio]"))+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("2 weeks"))+
  theme_classic()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    title = "Mobilitätsaufkommen vs Impfverlauf",
    subtitle = "An Orten wie Einzelhandel und Erholung",
    y = "Abweichung zum Rezerenzwert [%]"
  )

mobility_vaccine %>%
  group_by(date) %>% 
  summarise(max = mean(workplaces),
            sum = sum(Anzahl)) %>% 
  summarise(max = max,
            sum = cumsum(sum),
            date = date) %>% 
  ggplot()+
  geom_line(aes(x = date, y = max), size = 0.8, color = "darkslategray")+
  geom_line(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_point(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  scale_y_continuous(sec.axis = sec_axis(~.*1,name = "Anzahl Impfungen kumuliert [Mio]"))+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("2 weeks"))+
  theme_classic()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    title = "Mobilitätsaufkommen vs Impfverlauf",
    subtitle = "An Orten wie Einzelhandel und Erholung",
    y = "Abweichung zum Rezerenzwert [%]"
  )

mobility_vaccine %>%
  group_by(date) %>% 
  summarise(max = mean(residential),
            sum = sum(Anzahl)) %>% 
  summarise(max = max,
            sum = cumsum(sum),
            date = date) %>% 
  ggplot()+
  geom_line(aes(x = date, y = max), size = 0.8, color = "darkslategray")+
  geom_line(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_point(aes(x = date, y = sum/1000000), size = 0.8, color = "darkslateblue")+
  geom_hline(yintercept=0, linetype="dashed", color = "grey")+
  scale_y_continuous(sec.axis = sec_axis(~.*1,name = "Anzahl Impfungen kumuliert [Mio]"))+
  scale_x_date(labels = date_format("%b %y"),
               date_breaks = ("2 weeks"))+
  theme_classic()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  labs(
    title = "Mobilitätsaufkommen vs Impfverlauf",
    subtitle = "An Orten wie Einzelhandel und Erholung",
    y = "Abweichung zum Rezerenzwert [%]"
  )